﻿#region 命名空间

using Sharp.Portal.Mvc;
using System.Linq;
using System.Web.Mvc;
using System.Web.Routing;
using Sharp.Portal.Mvc.Extensions;

#endregion

namespace Sharp.WebBooter
{
    public class RouteConfig
    {
        public static void RegisterRoutes(RouteCollection routes)
        {
            var jsonValue = ValueProviderFactories.Factories.FirstOrDefault(x => x is JsonValueProviderFactory);
            if (jsonValue != null)
            {
                ValueProviderFactories.Factories.Remove(jsonValue);
                ValueProviderFactories.Factories.Add(new JsonDotNetValueProviderFactory());
            }
       

            routes.MapSaasRoute(
               name: "Login",
               url: "Login",
               defaults: new { controller = "Account", action = "Login" }
               );

            routes.MapSaasRoute(
                name: "Default",
                url: "{controller}/{action}/{id}",
                defaults: new { controller = "Home", action = "Index", id = UrlParameter.Optional },
                namespaces: new string[] { "Sharp.WebBooter.Controllers" }
                );
             
        }
    }
}